package com.ruoyi.cloudpc.service.impl;


import cn.binarywang.wx.miniapp.bean.WxMaJscode2SessionResult;
import com.alibaba.fastjson.JSONObject;

import com.ruoyi.cloudpc.service.WxMpSysUserService;
import com.ruoyi.common.wxUtils.WxMaConfiguration;
import com.ruoyi.system.service.ISysUserService;
import me.chanjar.weixin.common.error.WxErrorException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;



@Service
public class WxMpSysUserServiceImpl implements WxMpSysUserService {



    public JSONObject wxGetOpenId(String code) throws WxErrorException {
        JSONObject jsonObject = new JSONObject();

        WxMaJscode2SessionResult jscode2session = WxMaConfiguration.getMaService("wx196b57dd1ccd430b").jsCode2SessionInfo(code);
        jsonObject.put("openid", jscode2session.getOpenid());
        return jsonObject;
    }




}
